export type NodeStatus = 'idle' | 'running' | 'success' | 'error';

export interface FlowNode {
  id: string; // 唯一标识
  functionId: string; // 对应函数定义的ID
  position: { x: number; y: number };
  parameters: Record<string, any>; 
  status: NodeStatus;
  outputs?: any; // 运行结果存储
}

export interface FlowConnection {
  id: string;
  sourceId: string; // 起始节点ID
  targetId: string; // 目标节点ID
}

export interface FunctionDefinition {
  id: string;
  name: string;
  description?: string;
  parameters: FunctionParam[];
  execute: (params: Record<string, any>) => Promise<any>;
}

export interface FunctionParam {
  name: string;
  type: 'string' | 'number' | 'boolean';
  defaultValue: any;
  description?: string;
  unit?: string;
}